package  
{
	import flash.geom.Point;
	import flash.utils.ByteArray;
	/**
	 * ...
	 * @author Ivan
	 */
	public class Map 
	{
		private var _tileSet:Vector.<Tile>;
		
		public var mapWidth:int = 100;
		public var mapHeight:int = 100;
		public var tileWidth:int = 32;
		public var tileHeight:int = 24;
		
		//获取地图资源路径
		private var _mapTexturePath:String;
		public function get mapTexturePath():String {return _mapTexturePath;}
		
		//获取地图资源类型
		private var _mapTextureType:String;
		public function get mapTextureType():String {return _mapTextureType;}
		
		
		//出生点坐标
		public var spawnPosition:Point = new Point(12, 11);
		
		public function Map() 
		{
			_mapTexturePath = "map/";
			_mapTextureType = ".jpg";
			
			_tileSet = new Vector.<Tile>();
			for (var y:int = 0; y < mapHeight; y++ )
			{
				for (var x:int = 0; x < mapWidth; x++ )
				{
					var tile:Tile = new Tile();
					_tileSet.push(tile);
				}
			}
		}
		
		
		public function getTile(x:int, y:int):Tile 
		{
			if (x >= mapWidth || x < 0)
				return null;
			if (y >= mapHeight || y < 0)
				return null;
			return _tileSet[x + y * mapWidth];
		}
		
		public function read(buffer:ByteArray):void
		{
			
		}
		
		
		
	}

}